package fr.afcepf.vod.managedbean;

import java.util.List;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;

import org.primefaces.event.SelectEvent;
import org.primefaces.model.tagcloud.DefaultTagCloudItem;
import org.primefaces.model.tagcloud.DefaultTagCloudModel;
import org.primefaces.model.tagcloud.TagCloudItem;
import org.primefaces.model.tagcloud.TagCloudModel;

import fr.afcepf.vod.entities.Video;
import fr.afcepf.vod.metier.IGestionVideo;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;
import javax.faces.bean.SessionScoped;

@ManagedBean
@SessionScoped
public class MbRecherche {

	@ManagedProperty(value = "#{gestionVideoImpl}")
	private IGestionVideo gestionVideo;
	
	@ManagedProperty(value="#{mbNuageTags}")
	private MbNuageTags mbNuageTags;

	private String intitule;

	private List<Video> videoTrouve;

	public MbRecherche() {

	}
	
	public String getIntitule() {
		return intitule;
	}

	public void setIntitule(String intitule) {
		this.intitule = intitule;
	}

	public IGestionVideo getGestionVideo() {
		return gestionVideo;
	}

	public void setGestionVideo(IGestionVideo gestionVideo) {
		this.gestionVideo = gestionVideo;
	}

	public String rechercherIntitule() {
		videoTrouve = gestionVideo.rechercherVideo(intitule);
		mbNuageTags.initialiserNuage();
		return "RechercheVideoVisiteur.jsf";
	}

	public List<Video> getVideoTrouve() {
		return videoTrouve;
	}

	public void setVideoTrouve(List<Video> videoTrouve) {
		this.videoTrouve = videoTrouve;
	}

	public MbNuageTags getMbNuageTags() {
		return mbNuageTags;
	}

	public void setMbNuageTags(MbNuageTags mbNuageTags) {
		this.mbNuageTags = mbNuageTags;
	}

}
